package com.lehecai.core.api.user;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.lehecai.core.api.AbstractApiResultBean;

public class PrizeRank extends AbstractApiResultBean {
	
	public static final String QUERY_PERIOD  = "period";
	public static final String TICKET_PRINT_TIME = "ticket_print_time";
	public static final String LOTTERY_TYPE  = "lottery_type";
	
	private String username;
	private Double prize;
	private long uid;
	
	public static PrizeRank convertFromJSONObject(JSONObject object) {
		if (object == null) {
			return null;
		}
		PrizeRank prizeRank = new PrizeRank();

		prizeRank.username = getString(object, "username");
		prizeRank.prize = getDouble(object, "prize");
		prizeRank.uid = getLong(object, "uid");
		return prizeRank;
	}
	
	public static List<PrizeRank> convertFromJSONArray(JSONArray array) {
		if (array == null) {
			return null;
		}
		List<PrizeRank> list = new ArrayList<PrizeRank>();
		for (Iterator<?> iterator = array.iterator(); iterator.hasNext();) {
			JSONObject object = (JSONObject) iterator.next();
			list.add(convertFromJSONObject(object));
		}
		return list;
	}
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public static String getTicketPrintTimeStart() {
		return TICKET_PRINT_TIME;
	}

	public long getUid() {
		return uid;
	}

	public void setUid(long uid) {
		this.uid = uid;
	}

	public Double getPrize() {
		return prize;
	}

	public void setPrize(Double prize) {
		this.prize = prize;
	}

	
	
}
